/**
 * @Description:
 * @author 紫霞
 * @since 2019/1/17
 */
// React基础组件
import React from 'react'
// dva 连接组件 - 连接route和model
import { connect } from 'dva'
import { Editor } from 'react-draft-wysiwyg';
import 'react-draft-wysiwyg/dist/react-draft-wysiwyg.css';
import { EditorState, convertToRaw, ContentState } from 'draft-js';
import draftToHtml from 'draftjs-to-html';
import htmlToDraft from 'html-to-draftjs';
// 引入antd的组件
import { Popconfirm, Tabs, Form, Col, Row, Button, Input, Select, DatePicker, Radio, Cascader, Table, Checkbox, Tooltip, Tag, Upload, Icon, Modal, message } from 'antd'
import moment from 'moment';
import 'moment/locale/zh-cn';
import { CollapsiblePanels } from 'widget/CollapsiblePanels/index'
import Ueditor from '../../../../widget/Editor/Ueditor.js'
moment.locale('zh-cn');
import { get, cloneDeep } from "lodash";
const confirm = Modal.confirm;
const { TextArea } = Input;
const { RangePicker } = DatePicker;
const RadioGroup = Radio.Group;
const FormItem = Form.Item
const Option = Select.Option;
const TabPane = Tabs.TabPane;
//引用listPage
import ListPage from 'widget/PageTmpl/ListPage'
//导入路由组件，用于跳转等
import { Link, hashHistory } from 'dva/router'
// 导入项目全局配置文件
import config from 'config/config'
import Cookie from 'js-cookie'
import Uploader from 'widget/Upload'
// 引入model取值工具方法
import { mapStateToProps } from 'utils/view_utils'


import FlagBtn from 'widget/FlagBtn/FlagView'
import styles from './activityAreaDetailStyle.less'
import classnames from 'classnames/bind'
import { arrayOf, number } from 'prop-types';
import { tupleNum } from 'antd/lib/_util/type';
let cx = classnames.bind(styles);


/**
 * description 路由视图及事件处理
 * dispatch 分发到models中的effects对应事件名
 * model 用于获取models中state定义的数据
 * form 表单对象
 */
const formItemLayout = {
  labelCol: { span: 8 },
  wrapperCol: { span: 16 },
}
const formItemLayout1 = {
  labelCol: { span: 6 },
  wrapperCol: { span: 17 },
};
const formItemLayout01 = {
  labelCol: { span: 4 },
  wrapperCol: { span: 20 },
}

const formItemLayout02 = {
  labelCol: { span: 7 },
  wrapperCol: { span: 17 },
}
const formItemLayout03 = {
  labelCol: { span: 5 },
  wrapperCol: { span: 19 },
}
const formItemLayout04 = {
  labelCol: { span: 16 },
  wrapperCol: { span: 6 },
}
const formItemLayout05 = {
  labelCol: { span: 4 },
  wrapperCol: { span: 20 },
}
const formItemLayout06 = {
  labelCol: { span: 4 },
  wrapperCol: { span: 4 },
}
const formItemLayout07 = {
  labelCol: { span: 11 },
  wrapperCol: { span: 11 },
}
const formItemLayout08 = {
  labelCol: { span: 8 },
  wrapperCol: { span: 14 },
}
const imageLayout = {
  labelCol: { span: 2 },
  wrapperCol: { span: 22 },
}
const imageLayout3_21 = {
  labelCol: { span: 3 },
  wrapperCol: { span: 21 },
}

const routeView = function ({ dispatch, model, form }) {
  // 表单的子函数
  const { resetFields, getFieldDecorator, validateFields, setFieldsValue } = form
  // 取出model对象，命名空间
  const { modelObj, namespace } = model

  // modelObj.xxx获取model中状态机的值
  let { setHouse,lanmus, editorState, openImg, openImgSrc, modalIsOpen, estateListopt, activityAreaId, published, roleType, area1, activityDetail, editColumnIndex, columnType, acttives, acttiveList, columnInfoList, recordVideoUrlArr, StreamingList, liveStreamingList, CouponList, discountCouponList, builddingList, typeChange, areaList, detail, actionType, contentId,
    willDetail, Enroll, imgModal, gif, isSubmit, activityApply, TypeModalFlag, hashUrl, rcolumnTypeList } = modelObj
  const programaClomn = [
    {
      title: '序号',
      dataIndex: 'index',
      key: 'index',
      render: (a, item, index) => {
        return index + 1
      }
    },
    {
      title: '栏目标题',
      dataIndex: 'columnInfoTitle',
      key: 'columnInfoTitle',
    },
    {
      title: '栏目类别',
      dataIndex: 'columnInfoType',
      key: 'columnInfoType',
      render: (val, item, index) => {
        switch (val) {
          case 1: //楼盘
            return '楼盘'
          case 2://优惠券
            return '优惠券'
          case 5://直播
            return '直播'
          case 3://视频
            return '视频'
          case 4://活动
            return '活动'
        }
      }
    },
    {
      title: '操作',
      dataIndex: 'todo',
      key: 'todo',
      render: (val, item, index, b) => {
        return (
          <span>
            <FlagBtn node={<a onClick={() => actionModal(item, index)}>上移<span className="ant-divider" /></a>} btnId={''}> </FlagBtn>
            <FlagBtn node={<a onClick={() => EditSkip('edit', item, index)}>编辑<span className="ant-divider" /></a>} btnId={'20202'}> </FlagBtn>
            <FlagBtn node={
              <Popconfirm
                title="确定删除该栏目？"
                onConfirm={() => deleteEditSkip(index, item)}
              >
                <a>删除<span className="ant-divider" /></a>
              </Popconfirm>
            } btnId={'20203'}> </FlagBtn>
          </span>
        )
      }
    }
  ]
  const pagination = {
    current: Number(Enroll.pageNo || 1),
    pageNo: Number(Enroll.pageNo || 1),
    pageSize: Number(Enroll.pageSize || 10),
    total: Number(Enroll.total),
    showTotal: e => '共 ' + Enroll.total + ' 条',
    showSizeChanger: true,
    showQuickJumper: true,
    onChange: changePage, //分页事件
    onShowSizeChange: changePage, //每页条数
  }
  //翻页函数
  function changePage(page, pageSize) {
    dispatch({
      type: `${namespace}/getEnroll`,
      payload: { pageNo: page, pageSize: pageSize, activityId: contentId }
    });
  }

  if (!!modelObj.biz) {
    pageProps.biz = modelObj.biz
    pageProps.biz.syncBackCbf = (biz) => {
      dispatch({
        type: `${namespace}/updateStore`,
        payload: { biz }
      })
    }
  }
  // 上移栏目  columnInfoList栏目列表字段
  function actionModal(item, index) {
    if (index > 0) {
      // 换位置思想：删除再添加
      columnInfoList.splice(index, 1)
      columnInfoList.splice(index - 1, 0, item)
      for (let i = 0; i < columnInfoList.length; i++) {
        columnInfoList[i].number = i + 1
      }
      dispatch({
        type: `${namespace}/updateStore`,
        payload: {
          columnInfoList
        }
      })
    } else {
      message.error('已是首项，不能再上移了!')
    }
  }
  // 编辑栏目
  function EditSkip(todo, item, index) {
    typeChange = item.columnInfoType
    switch (item.columnInfoType) {
      case 1: //楼盘
        builddingList = Array.isArray(item.content) ? item.content : JSON.parse(item.content)
        console.log('builddingList',builddingList)
        for (let i = 0; i < builddingList.length; i++) {
          // 没有标签数据，添加一个空数组(针对旧数据)
          if(!builddingList[i].hasOwnProperty('houseTags')){
            builddingList[i]['houseTags'] = []
          }
          var itemss = builddingList[i]
          // 更新表单数据
          setFieldsValue({
            [`city${i}`]: [itemss.provinceCode ? itemss.provinceCode : itemss.province, itemss.cityCode ? itemss.cityCode : itemss.city],
            [`projectName${i}`]: itemss.productId,
            [`projecttitleone${i}`]: itemss.houseTags.length > 0 && itemss.houseTags[0] ? itemss.houseTags[0] : '',
            [`projecttitletwo${i}`]: itemss.houseTags.length > 0 && itemss.houseTags[1] ? itemss.houseTags[1] : '',
            [`projecttitlethree${i}`]: itemss.houseTags.length > 0 && itemss.houseTags[2] ? itemss.houseTags[2] : '',
            [`projecttitlefover${i}`]: itemss.houseTags.length > 0 && itemss.houseTags[3] ? itemss.houseTags[3] : '',
            [`describe${i}`]:itemss.describe?itemss.describe:''
          })
          dispatch({
            type: `${namespace}/getBusinessList`, payload: {
              province: builddingList[i].province,
              city: builddingList[i].city,
              index: i
            }
          })
        }
        dispatch({
          type: `${namespace}/updateStore`,
          payload: {
            builddingList,
          }
        })
        break;
      case 2://优惠券
        discountCouponList = Array.isArray(item.content) ? item.content : JSON.parse(item.content)
        dispatch({
          type: `${namespace}/updateStore`,
          payload: {
            discountCouponList,
          }
        })
        break;
      case 5://直播
        liveStreamingList = Array.isArray(item.content) ? item.content : JSON.parse(item.content)
        dispatch({
          type: `${namespace}/updateStore`,
          payload: {
            liveStreamingList,
          }
        })
        break
      case 3://视频
        recordVideoUrlArr = Array.isArray(item.content) ? item.content : JSON.parse(item.content)
        dispatch({
          type: `${namespace}/updateStore`,
          payload: {
            recordVideoUrlArr,
          }
        })
        break
      case 4://活动

        acttiveList = Array.isArray(item.content) ? item.content : JSON.parse(item.content)
        dispatch({
          type: `${namespace}/updateStore`,
          payload: {
            acttiveList,
          }
        })
        break
    }
    dispatch({
      type: `${namespace}/updateStore`,
      payload: {
        detail: item,
        willDetail: JSON.parse(JSON.stringify(item)),
        TypeModalFlag: true,
        typeChange,
        editColumnIndex: index,
        columnType: 'edit'
      }
    })
  }
  // 删除栏目
  function deleteEditSkip(index, item) {
    // 编辑状态下，删除数据库的数据（统计需求所需）
    if (actionType == 'edit') {
      if (columnInfoList.length == 1) {
        message.error('必须存在一条栏目!')
        return false
      }
      dispatch({
        type: `${namespace}/deleteByColumnInfoId`,
        payload: {
          columnInfoId: item.columnInfoId
        }
      })
    }
    columnInfoList.splice(index, 1)
    dispatch({
      type: `${namespace}/updateStore`,
      payload: {
        columnInfoList
      }
    })
  }
  function showTypeModal() {
    form.setFields({
      columnInfoTitle: '',
      columnInfoType: '',
    })
    dispatch({
      type: `${namespace}/updateModel`,
      payload: {
        TypeModalFlag: true,
        detail: {
          columnInfoTitle: '',
          columnInfoType: '',
          content: []
        },
        builddingList: [],
        discountCouponList: [],
        liveStreamingList: [],
        acttiveList: [],
        columnType: 'add',
        recordVideoUrlArr: [],
        typeChange: ''
      }
    })
  }
  function changeCity(value, index, selectedOptions) {
    let opt = {
      province: value[0],
      city: value[1]
    }
    builddingList[index].province = value[0];
    builddingList[index].city = value[1];
    // 获取中文
    if (selectedOptions.length == 1) {
      builddingList[index].provinceName = selectedOptions[0].label;
    } else if (selectedOptions.length > 1) {
      builddingList[index].provinceName = selectedOptions[0].label;
      builddingList[index].cityName = selectedOptions[1].label;
    }

    dispatch({
      type: `${namespace}/updateStore`,
      payload: { builddingList, detail }
    });
    dispatch({
      type: `${namespace}/getBusinessList`,
      payload: { province: value[0], city: value[1], index }
    })
  }

  //所有类型改变时（除date image）
  function inputChange(val, type, index, opt) {
    if (type == 'columnInfoType') {
      // 切换栏目类型
      detail[type] = val
      detail['columnInfoName'] = index.props.children
      if (columnType == 'add') {
        detail['content'] = [] //清空已选择栏目类型的内容
      }
      switch (val) {
        case 1: //楼盘
          if (builddingList.length == 0) {
            builddingList.push({
              houseTags: []
            })
          }
          dispatch({ type: `${namespace}/getAreaList` })
          dispatch({
            type: `${namespace}/updateModel`,
            payload: { builddingList }
          });
          break;
        case 2://优惠券
          if (discountCouponList.length == 0) {
            discountCouponList.push({})
          }
          dispatch({ type: `${namespace}/getCouponsList` })
          dispatch({
            type: `${namespace}/updateModel`,
            payload: { discountCouponList }
          });
          break;
        case 5://直播liveStreamingList
          if (builddingList.length == 0) {
            liveStreamingList.push({})
          }
          dispatch({
            type: `${namespace}/updateModel`,
            payload: { liveStreamingList }
          });
          dispatch({ type: `${namespace}/getliveStreamingList` })
          break
        case 4://活动acttiveList
          if (acttiveList.length == 0) {
            acttiveList.push({})
          }
          dispatch({
            type: `${namespace}/updateModel`,
            payload: { acttiveList }
          });
          dispatch({ type: `${namespace}/getactiveList` })
          break
      }
      dispatch({
        type: `${namespace}/updateModel`,
        payload: { typeChange: val }
      });
    } else if (type == 'projectName') {
      // 楼盘productId
      let parmas = estateListopt[index]
      let options = {}
      for (let i = 0; i < parmas.length; i++) {
        if (val === parmas[i].productId) {
          options = parmas[i]
        }
      }
      builddingList[index] = Object.assign(builddingList[index], options)
      detail['content'] = builddingList;
      dispatch({
        type: `${namespace}/getloudetail`,
        payload: {
          productId: val,
          index
        }
      })
    } else if (type == 'projecttitleone') {
      // 楼盘标签
      setHouse[0] = val
      builddingList[index].houseTags[0] = val
      detail['content'] = builddingList;
      dispatch({
        type: `${namespace}/updateStore`,
        payload: { builddingList,setHouse }
      });
    }
    else if (type == 'projecttitletwo') {
      // 楼盘标签
      setHouse[1] = val
      builddingList[index].houseTags[1] = val
      detail['content'] = builddingList;
      dispatch({
        type: `${namespace}/updateStore`,
        payload: { builddingList,setHouse }
      });
    } else if (type == 'projecttitlethree') {
      // 楼盘标签
      setHouse[2] = val
      builddingList[index].houseTags[2] = val
      detail['content'] = builddingList;
      dispatch({
        type: `${namespace}/updateStore`,
        payload: { builddingList,setHouse }
      });
    } else if (type == 'projecttitlefover') {
      // 楼盘标签
      setHouse[3] = val
      builddingList[index].houseTags[3] = val
      detail['content'] = builddingList;
      dispatch({
        type: `${namespace}/updateStore`,
        payload: { builddingList,setHouse }
      });
    }else if (type == 'describe') {
      // 描述
      builddingList[index].describe = val
      detail['content'] = builddingList;
      dispatch({
        type: `${namespace}/updateStore`,
        payload: { builddingList }
      });
    } else if (type == 'discountCoupon') {
      // 优惠券CouponList
      // 获取优惠券详情信息
      dispatch({
        type: `${namespace}/getyouhui`,
        payload: {
          id: val,
          index
        }
      })
    } else if (type == 'liveStreaming') {
      // 直播
      let parmas = StreamingList
      let options = {}
      for (let i = 0; i < parmas.length; i++) {
        if (val === parmas[i].id) {
          options = parmas[i]
        }
      }
      liveStreamingList[index] = options
      detail['content'] = liveStreamingList;
      dispatch({
        type: `${namespace}/updateStore`,
        payload: { liveStreamingList }
      });
      // dispatch({
      //   type: `${namespace}/getliveStreamingDetail`,
      //   payload:{
      //     id: val,
      //     index
      //   }
      // })
    } else if (type == 'businessId') {
      // 报名活动
      let parmas = acttives
      let options = {}
      for (let i = 0; i < parmas.length; i++) {
        if (val === parmas[i].contentId) {
          options = parmas[i]
        }
      }
      acttiveList[index] = options
      detail['content'] = acttiveList;
      dispatch({
        type: `${namespace}/updateStore`,
        payload: { acttiveList }
      });
    }
    else if (type == 'isSelfTemplate') {
      // 专区样式
      detail[type] = val
    } else if (type == 'columnInfoTitle') {
      // 栏目标题
      detail[type] = val
    } else if (type == 'activityAreaName') {
      // 专区名称
      activityDetail[type] = val
    } else if (type == 'regionId') {
      // 所属区域
      activityDetail['regionId'] = val
      activityDetail['regionName'] = opt.props.children;
    } else if (type == 'css1') {
      activityDetail[type] = val
    } else if (type == 'activityAreaRule') {
      activityDetail['activityAreaRule'] = val
      form.setFields({
        activityAreaRule: val
      })
    }else if(type == 'showCityType'){
      detail[type] = val
    }
    else if(type == 'sortType'){
      detail[type] = val
    }
    // dispatch({
    //   type: `${namespace}/updateModel`,
    //   payload: { detail }
    // });
  }
  // 添加项目，分楼盘、优惠券、视频等
  function addColumn(type) {
    switch (type) {
      case 1:
        builddingList.push({ houseTags: [] })
        estateListopt.push([])
        dispatch({
          type: `${namespace}/updateModel`,
          payload: { builddingList }
        })
        break;
      case 2:
        discountCouponList.push({})
        dispatch({
          type: `${namespace}/updateModel`,
          payload: { discountCouponList }
        })
        break
      case 5:
        liveStreamingList.push({})
        dispatch({
          type: `${namespace}/updateModel`,
          payload: { liveStreamingList }
        })
        break
      case 4:
        acttiveList.push({})
        dispatch({
          type: `${namespace}/updateModel`,
          payload: { acttiveList }
        })
        break
    }

  }
  //图片删除时
  function removeImgUrl(type, value) {
    if (type == 'bannerImgUrl') {
      activityDetail[type] = ''
      form.setFields({
        bannerImgUrl: '',
      })
    } else if (type == 'shareImgUrl') {
      activityDetail[type] = ''
      form.setFields({
        shareImgUrl: '',
      })
    }
    else {
      detail[type] = ''
      recordVideoUrlArr.shift(value)
      form.setFields({
        columnPosters: '',
      })
      // detail['content'] = []
    }
    dispatch({
      type: `${namespace}/updateModel`,
      payload: { detail, recordVideoUrlArr, activityDetail }
    });
  }
  /*
** randomWord 产生任意长度随机字母数字组合
** randomFlag-是否任意长度 min-任意长度最小位[固定位数] max-任意长度最大位
**
*/
  function randomWord(randomFlag, min, max) {
    var str = "",
      range = min,
      arr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];

    // 随机产生
    if (randomFlag) {
      range = Math.round(Math.random() * (max - min)) + min;
    }
    for (var i = 0; i < range; i++) {
      let pos = Math.round(Math.random() * (arr.length - 1));
      str += arr[pos];
    }
    return str;
  }
  //图片增加时
  function updateImageModel(value, type, fileObj) {
    let Word1 = randomWord(false, 8, 10)
    let Word2 = randomWord(false, 6, 10)
    if (type == 'columnPosters') {
      let videoObj = {
        url: value,
        name: value,
        id: new Date().getTime() + Word1 + '-' + Word2
      }
      recordVideoUrlArr = []
      recordVideoUrlArr.push(videoObj)
      detail['content'] = recordVideoUrlArr
      dispatch({
        type: `${namespace}/updateModel`,
        payload: { detail, recordVideoUrlArr }
      });
    } else if (type == 'bannerImgUrl') {
      // banner图
      activityDetail[type] = value
    } else if (type == 'shareImgUrl') {
      // 分享海报图
      activityDetail[type] = value
    }
    dispatch({
      type: `${namespace}/updateModel`,
      payload: { detail }
    });
  };

  function hideTypeModal() {
    dispatch({
      type: `${namespace}/updateStore`,
      payload: { TypeModalFlag: false }
    });
    if (columnType == 'edit') {
      detail = willDetail
      columnInfoList[editColumnIndex] = detail
      dispatch({
        type: `${namespace}/updateStore`,
        payload: { detail, columnInfoList }
      });
      form.setFields({
        columnInfoTitle: '',
        columnInfoType: '',
      })
    }
  }
  // 去两侧空格
  function removeK(item) {
    return item.trim()
  }
  // 新增栏目
  function onOkModal() {
    if (removeK(detail.columnInfoTitle) === '') {
      message.error('请填写栏目标题！')
      return false
    }
    if (detail.columnInfoType === '') {
      message.error('请选择栏目类型！')
      return false
    }
    if (detail.content.length === 0) {
      switch (detail.columnInfoType) {
        case 1: //楼盘
          message.error('请选择楼盘！')
          break;
        case 2://优惠券
          message.error('请选择优惠券！')
          break;
        case 5://直播
          message.error('请选择直播！')
          break
        case 3://视频
          message.error('请上传视频！')
          break
        case 4://活动
          message.error('请选择活动！')
          break
      }
      return false
    } else {
      if (detail.columnInfoType === 1) {
        //楼盘
        const arr = []
        let alllist = Array.isArray(detail.content) ? detail.content : JSON.parse(detail.content)
        for (let i = 0; i < alllist.length; i++) {
          let data = alllist[i]
          if (data.province && removeK(data.province) != '' && !data.projectName) {
            message.error('请选择项目！')
            return false
          } else if (data.projectName && data.provinceName) {
            arr.push(data)
          }
        }
        // 清除空内容的标签
        for (let a = 0; a < arr.length; a++) {
          let protag = arr[a].houseTags
          for (let b = 0; protag&&b < protag.length; b++) {
            if (protag[b] == undefined || protag[b] == '') {
              arr[a].houseTags.splice(b, 1)
            }
          }
        }
        detail.content = arr
        detail['showCityType'] = detail['showCityType']?detail['showCityType']:1
        detail['sortType'] = detail['sortType']?detail['sortType']:1
      } else if (detail.columnInfoType === 2) {
        //优惠券
        const arr = []
        let alllist = Array.isArray(detail.content) ? detail.content : JSON.parse(detail.content)
        for (let i = 0; i < alllist.length; i++) {
          let data = alllist[i]
          if (data.couponsConfigId) {
            arr.push(data)
          }
        }
        detail.content = arr
      } else if (detail.columnInfoType == 5) {
        //直播
        const arr = []
        let alllist = Array.isArray(detail.content) ? detail.content : JSON.parse(detail.content)
        for (let i = 0; i < alllist.length; i++) {
          let data = alllist[i]
          if (data.id) {
            arr.push(data)
          }
        }
        detail.content = arr
      } else if (detail.columnInfoType == 4) {
        //活动
        const arr = []
        let alllist = Array.isArray(detail.content) ? detail.content : JSON.parse(detail.content)
        for (let i = 0; i < alllist.length; i++) {
          let data = alllist[i]
          if (data.contentId) {
            arr.push(data)
          }
        }
        detail.content = arr
      }
    }
    // if (actionType == 'add') {
    lanmus = lanmus + 1
    dispatch({
      type: `${namespace}/updateStore`,
      payload: { lanmus }
    })
    detail['number'] = lanmus
    // }
    // columnInfoList.push(detail)
    if (columnType == 'add') {
      // 添加栏目
      columnInfoList.push(detail)
    } else {
      // 编辑栏目
      columnInfoList[editColumnIndex] = detail
    }
    // 保存数据并清空模态框内容
    form.setFields({
      columnInfoTitle: '',
      columnInfoType: '',
    })
    dispatch({
      type: `${namespace}/updateStore`,
      payload: {
        TypeModalFlag: false,
        columnInfoList,
        detail: {
          columnInfoTitle: '',
          columnInfoType: '',
          content: []
        },
        builddingList: [],
        discountCouponList: [],
        liveStreamingList: [],
        acttiveList: [],
        recordVideoUrlArr: []
      }
    });
  }
  //提交
  function submit(type) {
    form.validateFields((err, values) => {
      if (err) {
        return false
      }
      if (columnInfoList.length == 0) {
        message.error('请添加栏目！')
        return false
      }
      activityDetail['columnInfoList'] = columnInfoList
      dispatch({
        type: `${namespace}/updateStore`,
        payload: { activityDetail }
      })
      dispatch({
        type: `${namespace}/submit`,
        payload: { activityDetail, type, activityAreaId }
      })
    });
  }
  const changeState = (payload) => {
    dispatch({
      type: `${namespace}/updateStore`,
      payload: { ...payload }
    })
  }
  /*
    关闭预览图
  */
  function hideImgModal() {
    dispatch({
      type: `${namespace}/updateStore`,
      payload: {
        openImg: false
      }
    })
  }
  function openImgpic(src) {
    dispatch({
      type: `${namespace}/updateStore`,
      payload: {
        openImg: true,
        openImgSrc: src
      }
    })
  }
  function showeye(item, index) {
    gif[index].eyeisShow = true
    dispatch({
      type: `${namespace}/updateStore`,
      payload: {
        gif,
      }
    })
  }
  function hideeye(item, index) {
    gif[index].eyeisShow = false
    dispatch({
      type: `${namespace}/updateStore`,
      payload: {
        gif
      }
    })
  }
  // 删除各类型项目
  function deleteProject(type, index) {
    switch (type) {
      case 'building':
        builddingList.splice(index, 1)
        estateListopt.splice(index, 1)
        detail['content'] = builddingList;
        dispatch({
          type: `${namespace}/updateStore`,
          payload: {
            detail,
            builddingList,
            estateListopt
          }
        })
        for (let i = 0; i < builddingList.length; i++) {
          var item = builddingList[i]
          // 更新表单数据
          setFieldsValue({
            [`city${i}`]: [item.provinceCode ? item.provinceCode : item.province, item.cityCode ? item.cityCode : item.city],
            [`projectName${i}`]: item.productId,
            [`projecttitleone${i}`]: item.houseTags.length > 0 && item.houseTags[0] ? item.houseTags[0] : '',
            [`projecttitletwo${i}`]: item.houseTags.length > 0 && item.houseTags[1] ? item.houseTags[1] : '',
            [`projecttitlethree${i}`]: item.houseTags.length > 0 && item.houseTags[2] ? item.houseTags[2] : '',
            [`projecttitlefover${i}`]: item.houseTags.length > 0 && item.houseTags[3] ? item.houseTags[3] : '',
            [`describe${i}`]:item.describe?item.describe:''
          })
        }
        break
      case 'discountCoupon':
        discountCouponList.splice(index, 1)
        detail['content'] = discountCouponList;
        dispatch({
          type: `${namespace}/updateStore`,
          payload: {
            detail,
            discountCouponList,
          }
        })
        for (let i = 0; i < discountCouponList.length; i++) {
          var item = discountCouponList[i]
          // 更新表单数据
          setFieldsValue({
            [`discountCoupon${i}`]: item.couponsConfigId,
          })
        }
        break
      case 'liveStreaming':
        liveStreamingList.splice(index, 1)
        detail['content'] = liveStreamingList;
        dispatch({
          type: `${namespace}/updateStore`,
          payload: {
            detail,
            liveStreamingList,
          }
        })
        for (let i = 0; i < liveStreamingList.length; i++) {
          var item = liveStreamingList[i]
          // 更新表单数据
          setFieldsValue({
            [`liveStreaming${i}`]: item.id,
          })
        }
        break
      case 'active':
        acttiveList.splice(index, 1)
        detail['content'] = acttiveList;
        dispatch({
          type: `${namespace}/updateStore`,
          payload: {
            detail,
            acttiveList,
          }
        })
        for (let i = 0; i < acttiveList.length; i++) {
          var item = acttiveList[i]
          // 更新表单数据
          setFieldsValue({
            [`businessId${i}`]: item.contentId,
          })
        }
        break
    }

  }
  function onEditorStateChange(e) {
    let text = draftToHtml(convertToRaw(e.getCurrentContent()))
    // 更新表单的值
    setFieldsValue({
      activityAreaRule: e
    })
    activityDetail.activityAreaRule = text
    dispatch({
      type: `${namespace}/updateStore`,
      payload: {
        activityDetail,
        editorState: e
      }
    })
  }
  function debounce(fn, wait) {
    var timer = null;
    return function () {

    }
  }
  var timer = null;
  function handleSearch(value, type) {
    if (timer !== null) {
      clearTimeout(timer);
    }
    timer = setTimeout(function () {
      if (type == 'live') {
        dispatch({
          type: `${namespace}/getliveStreamingList`,
          payload: {
            title: value
          }
        })
      }
      // else if (type == 'Coupon') {
      //   dispatch({
      //     type: `${namespace}/getCouponsList`,
      //     payload: {
      //       title: value
      //     }
      //   })
      // } else if (type == 'active') {
      //   dispatch({
      //     type: `${namespace}/getactiveList`,
      //     payload: {
      //       title: value
      //     }
      //   })

      // }
    }, 1000);


  };

  // 活动日期  首页活动报名按钮​
  return (
    <div className={cx('pageLayout')}>
      <div className='public_listMain'>
        <div className={"functionButton"}>
          {<Button type='primary' onClick={e => submit('save')} loading={modelObj.btnLoading}>保存</Button>}
          {published == 0 && <Button type='primary' onClick={e => submit('saveAndPublish')}>发布</Button>}
          {published == 1 && <Button type='primary' onClick={e => submit('unpublish')}>取消发布</Button>}
        </div>
        {actionType != 'detail' &&
          <Form>
            <div className="boxShadow">
              <div className={styles.box}>
                <CollapsiblePanels title='专区基本信息' hideUpDownBtn={true}>
                  <Row>
                    <Col span={24}>
                      <Row>
                        <Col className="col" span={12}>
                          <FormItem label='专区名称'  {...formItemLayout03}>
                            {getFieldDecorator('activityAreaName', {
                              rules: [{
                                required: true, message: '限制10个字符', max: 10
                              }],
                              initialValue: activityDetail.activityAreaName,
                            })(
                              <Input placeholder="限制10个字符" onChange={(e) => { inputChange(e.target.value, 'activityAreaName') }} />
                            )}
                          </FormItem>
                        </Col>
                      </Row>
                      <Row>
                        <Col className="col" span={12}>
                          <FormItem {...formItemLayout03} label="所属区域">
                            {getFieldDecorator('regionId', {
                              initialValue: activityDetail.regionId,
                              rules: [
                                {
                                  required: true, message: '请选择所属区域'
                                },
                              ],
                            })(
                              // notFoundContent={'该省市中无楼盘'}
                              <Select placeholder='请选择区域' onChange={(e, opt) => {
                                inputChange(e, 'regionId', 0, opt)
                              }}>
                                {
                                  roleType == 1 ? <Select.Option key='0' value='0'>集团</Select.Option> : null
                                }

                                {area1.length > 0 && area1.map((item) => {
                                  return <Select.Option key={item.value} value={item.value}>{item.label}</Select.Option>
                                })}
                              </Select>)}
                          </FormItem>
                        </Col>
                      </Row>
                      <Row className="preview_zhuan_a">
                        <Col className="col" span={20}>
                          <FormItem label="专区样式" {...imageLayout3_21}>
                            {getFieldDecorator('css1', {
                              initialValue: activityDetail.css1,
                              rules: [
                                { required: true, message: '请选择专区样式' },
                              ],
                            })(
                              <Radio.Group onChange={(e) => { inputChange(e.target.value, 'css1') }} disabled={detail.isSelfTemplate === true}>
                                {gif.map((item, index) => {
                                  return (
                                    <div className={cx('preview_zhuan')} key={index}>
                                      <div className={cx('lookatPicCont')} onMouseEnter={() => showeye(item, index)} onMouseLeave={() => hideeye(item, index)}>
                                        <img className={cx('imgBg')} src={item.source} alt="专区样式图" />
                                        {item.eyeisShow && <div className="lookatPic" onClick={() => openImgpic(item.source)}>
                                          <Icon type="eye" />
                                        </div>}
                                      </div>
                                      <div className={cx('center')}><Radio value={item.style}>样式{index + 1}</Radio></div>
                                    </div>
                                  )
                                })}
                              </Radio.Group>
                            )}
                          </FormItem>
                        </Col>
                      </Row>
                      <Row>
                        <Col className="col" span={12}>
                          <FormItem
                            {...formItemLayout03}
                            extra={'图片分辨率需为1500px*1500px，且文件大小在500kb以下，支持jpg，png格式。'}
                            // disabled={actionType == 'detail'}
                            required={true}
                            label="banner图">
                            {getFieldDecorator('bannerImgUrl', {
                              initialValue: activityDetail.bannerImgUrl,
                              rules: [
                                { required: true, whitespace: true, message: '请上传banner图' }
                              ],
                            })(
                              <div className={cx('uploaderBox')}>
                                <div className={cx('uploaderDiv')}>
                                  <Uploader
                                    uploadedUrls={activityDetail.bannerImgUrl}
                                    removeFileCbf={() => { removeImgUrl('bannerImgUrl') }}
                                    uploadSuccessCbf={(imgUrl) => { updateImageModel(imgUrl, 'bannerImgUrl') }}
                                    showType={'6'}
                                    minCropBoxWidth={1500}
                                    minCropBoxHeight={1500}
                                    fileType='image'
                                    fileMaxSize='0.5'
                                    maxFiles='1' />
                                </div>
                              </div>)}

                          </FormItem>

                        </Col>
                      </Row>
                      <Row>
                        <Col className="col" span={12}>
                          <FormItem
                            {...formItemLayout03}
                            extra={'图片分辨率需为1500px*2668px，且文件大小在500kb以下，支持jpg，png格式。'}
                            // disabled={actionType == 'detail'}
                            required={true}
                            label="分享海报图">
                            {getFieldDecorator('shareImgUrl', {
                              initialValue: activityDetail.shareImgUrl,
                              rules: [
                                { required: true, message: '请上传分享海报图' }
                              ],
                            })(
                              <div className={cx('uploaderBox')}>
                                <div className={cx('uploaderDiv')}>
                                  <Uploader
                                    uploadedUrls={activityDetail.shareImgUrl}
                                    removeFileCbf={() => { removeImgUrl('shareImgUrl') }}
                                    uploadSuccessCbf={(imgUrl) => { updateImageModel(imgUrl, 'shareImgUrl') }}
                                    showType={'6'}
                                    minCropBoxWidth={1500}
                                    minCropBoxHeight={2668}
                                    fileType='image'
                                    fileMaxSize='0.5'
                                    maxFiles='1' />
                                </div>
                              </div>)}

                          </FormItem>

                        </Col>
                      </Row>
                      <Row>
                        <Col className="col" span={20}>
                          <FormItem
                            {...imageLayout3_21}
                            required={true}
                            label="活动规则">
                            {getFieldDecorator('activityAreaRule', {
                              initialValue: activityDetail.activityAreaRule,
                              rules: [
                                { required: true, message: '请填写活动规则' },
                              ],
                            })(
                              // <TextArea rows={4} onChange={e => { inputChange(e.target.value, 'activityAreaRule') }} />
                              // <Editor
                              //   editorState={editorState}
                              //   toolbarClassName="toolbarClassName"
                              //   wrapperClassName="wrapperClassName"
                              //   editorClassName="editorClassName"
                              //   onEditorStateChange={(e) => onEditorStateChange(e)}
                              // />
                              <Ueditor id="addBaseDesc"
                                style={{ width: '100%', height: 900 }}
                                editable={true}
                                html={activityDetail.activityAreaRule || ''}
                                height={500}
                                isSubmit={isSubmit}
                                isShowPhone={false}
                                inputChange={e => {
                                  inputChange(e, 'activityAreaRule')
                                }}
                                isSubmit={
                                  e => {
                                    inputChange(e, 'activityAreaRule')
                                    // dispatch({ type: `${namespace}/updateStore`, payload: { isSubmit: e.isSubmit } }) 
                                  }
                                }
                              />
                            )}
                          </FormItem>

                        </Col>
                      </Row>
                    </Col>
                  </Row>
                </CollapsiblePanels>
              </div>

              <CollapsiblePanels title={'栏目信息'} hideUpDownBtn={false} >
                <Row>
                  <Col span={18}>
                    <Table
                      columns={programaClomn}
                      dataSource={columnInfoList}
                    />
                  </Col>
                  <Col span={3} offset={2}>
                    <FlagBtn node={<Button onClick={() => showTypeModal()} type="primary">添加栏目</Button>} btnId={''}> </FlagBtn>
                  </Col>
                </Row>
              </CollapsiblePanels>
            </div>
          </Form>
        }

      </div>

      <Modal
        className="lanModel"
        title={columnType == 'add' ? "添加栏目" : '编辑栏目'}
        maskClosable={true}
        onCancel={() => { hideTypeModal() }}
        onOk={() => {
          onOkModal()
        }}
        visible={TypeModalFlag}
      >
        <Row className="houseListqq">
          <Col className="col" span={12}>
            <FormItem label='栏目标题'  {...formItemLayout03}>
              {getFieldDecorator('columnInfoTitle', {
                rules: [{
                  message: '输入栏目标题，不超过10个字', max: 10
                }],
                initialValue: detail.columnInfoTitle,
              })(
                <Input maxLength="10" placeholder="输入栏目标题，不超过10个字" onChange={(e) => { inputChange(e.target.value, 'columnInfoTitle') }} />
              )}
            </FormItem>
          </Col>
        </Row>
        <Row className="houseListqq">
          <Col className="col" span={12}>
            <FormItem label='栏目类型'  {...formItemLayout03}>
              {getFieldDecorator('columnInfoType', {
                initialValue: detail.columnInfoType,
              })(
                <Select
                  value={detail.columnInfoType}
                  onChange={(value, option) => inputChange(value, 'columnInfoType', option)} placeholder="请选择栏目类型">
                  {rcolumnTypeList.map((item, index) => {
                    return (
                      <Select.Option value={item.value}>{item.name}</Select.Option>
                    )
                  })}
                </Select>)}
            </FormItem>
          </Col>
        </Row>
        <Row>
          <Col span={20}>
            {typeChange && typeChange === 1 ?
              <div>
                <Row className={cx('ml15')}>
                  <Col span={12}>
                    <FormItem {...formItemLayout03} label="选择城市">
                      {getFieldDecorator('showCityType', {
                        initialValue: detail.showCityType||1,
                        rules: [
                          { whitespace: true, message: '请选择城市', type: 'number' },
                        ],
                      })(
                        <Radio.Group onChange={(e) => inputChange(e.target.value, 'showCityType')}>
                          <Radio value={1}>显示全部城市</Radio>
                          <Radio value={2}>显示当前定位城市</Radio>
                        </Radio.Group>
                      )}
                    </FormItem>
                  </Col>
                  <Col span={1}>
                    <FormItem>
                      <Tooltip
                        title={
                          <div>
                            <div>显示全部城市：手机端默认看到添加到该栏目的所有城市楼盘；</div>
                            <div>显示当前定位城市：手机端默认只看到用户定位所在的城市楼盘</div>
                          </div>

                        }
                      >
                        <Icon className={styles.iconTooltip} type="question-circle" />
                      </Tooltip>
                    </FormItem>
                  </Col>
                </Row>
                <Row className={cx('ml15')}>
                  <Col span={12}>
                    <FormItem {...formItemLayout03} label="排序设置">
                      {getFieldDecorator('sortType', {
                        initialValue: detail.sortType||1,
                        rules: [
                          { whitespace: true, message: '请选择排序设置', type: 'number' },
                        ],
                      })(
                        <Radio.Group onChange={(e) => inputChange(e.target.value, 'sortType')}>
                          <Radio value={1}>按系统设置排序</Radio>
                          <Radio value={2}>按用户定位排序</Radio>
                        </Radio.Group>
                      )}
                    </FormItem>
                  </Col>
                  <Col span={1}>
                    <FormItem>
                      <Tooltip
                        title={
                          <div>
                            <div>按系统设置排序：按系统设置的排序先后顺序排序</div>
                            <div>按用户定位排序：根据用户当前定位由近到远排序。</div>
                          </div>

                        }
                      >
                        <Icon className={styles.iconTooltip} type="question-circle" />
                      </Tooltip>
                    </FormItem>
                  </Col>
                </Row>
                {
                  builddingList.map((item, index) => {
                    return (
                      <div className={cx('houseList')}>
                        <Row key={index}>
                          <Col className="col" span={8}>
                            <FormItem
                              {...formItemLayout02}
                              label='省市'>
                              {getFieldDecorator(`city${index}`, {
                                initialValue: ([item.provinceCode ? item.provinceCode : item.province, item.cityCode ? item.cityCode : item.city])
                              })(
                                <Cascader
                                  options={areaList}
                                  disabled={actionType == 'detail'}
                                  onChange={(e, selectedOptions) => {
                                    changeCity(e, index, selectedOptions)
                                  }}
                                  placeholder={'请选择所属城市'}
                                // changeOnSelect
                                />
                              )}
                            </FormItem>
                          </Col>
                          <Col className="col" span={8}>
                            <div className="marleft5">
                              <FormItem
                                {...imageLayout}>
                                {getFieldDecorator(`projectName${index}`, {
                                  // initialValue: '请选择项目',
                                  rules: [
                                    { message: '请先选择省市再选择项目' },
                                  ],
                                  initialValue: item.productId ? item.productId : '',
                                })(
                                  <Select
                                    placeholder={'请选择项目'}
                                    disabled={actionType == 'detail'}
                                    onChange={(e, option) => inputChange(e, 'projectName', index, option)}>
                                    {estateListopt.length > 0 && estateListopt[index] && estateListopt[index].length > 0 ? estateListopt[index].map((items, idx) => {
                                      return (
                                        <Select.Option key={idx} value={items.productId}>{items.name}</Select.Option>)
                                    }) : []}
                                  </Select>
                                )}
                              </FormItem>
                            </div>
                          </Col>
                          {
                            index > 0 ?
                              <Col className="col" span={1}>
                                <FormItem>
                                  <Icon onClick={() => deleteProject('building', index)} className="minusCircle" type="minus-circle" />
                                </FormItem>
                              </Col>
                              : null
                          }
                        </Row>
                        <Row>
                          <Col className="col" span={6}>
                            <FormItem label='楼盘标签'  {...formItemLayout}>
                              {getFieldDecorator(`projecttitleone${index}`, {
                                rules: [{
                                  message: '限制4个字符', max: 4
                                }],
                                initialValue: item.houseTags && item.houseTags.length > 0 && item.houseTags[0] ? item.houseTags[0] : '',
                              })(
                                <Input placeholder="限制4个字符" maxLength="4" onChange={(e) => { inputChange(e.target.value, 'projecttitleone', index) }} />
                              )}
                            </FormItem>
                          </Col>
                          <Col className={cx('loub2')} span={4}>
                            <FormItem label=''>
                              {getFieldDecorator(`projecttitletwo${index}`, {
                                rules: [{
                                  message: '限制4个字符', max: 4
                                }],
                                initialValue: item.houseTags && item.houseTags.length > 0 && item.houseTags[1] ? item.houseTags[1] : '',
                              })(
                                <Input placeholder="限制4个字符" maxLength="4" onChange={(e) => { inputChange(e.target.value, 'projecttitletwo', index) }} />
                              )}
                            </FormItem>
                          </Col>
                          <Col className={cx('loub2')} span={4}>
                            <FormItem label=''>
                              {getFieldDecorator(`projecttitlethree${index}`, {
                                rules: [{
                                  message: '限制4个字符', max: 4
                                }],
                                initialValue: item.houseTags&&item.houseTags.length>0&&item.houseTags[2]? item.houseTags[2] : '',
                              })(
                                <Input placeholder="限制4个字符" maxLength="4" onChange={(e) => { inputChange(e.target.value, 'projecttitlethree', index) }} />
                              )}
                            </FormItem>
                          </Col>
                          <Col className={cx('loub2')} span={4}>
                            <FormItem label=''>
                              {getFieldDecorator(`projecttitlefover${index}`, {
                                rules: [{
                                  message: '限制4个字符', max: 4
                                }],
                                initialValue: item.houseTags&&item.houseTags.length>0&&item.houseTags[3]? item.houseTags[3] : '',
                              })(
                                <Input placeholder="限制4个字符" maxLength="4" onChange={(e) => { inputChange(e.target.value, 'projecttitlefover', index) }} />
                              )}
                            </FormItem>
                          </Col>
                        </Row>
                        <Row>
                          <Col span={8}>
                            <FormItem label='楼盘描述'  {...formItemLayout02}>
                              {getFieldDecorator(`describe${index}`, {
                                rules: [{
                                  message: '限制10个字符', max: 10
                                }],
                                initialValue: item.describe ? item.describe : '',
                              })(
                                <Input placeholder="限制10个字符" maxLength="10" onChange={(e) => { inputChange(e.target.value, 'describe', index) }} />
                              )}
                            </FormItem>
                          </Col>
                        </Row>
                      </div>
                    )
                  })
                }
              </div> : null}
            {typeChange && typeChange === 2 ?
              <div>
                {discountCouponList.map((item, index) => {
                  return (
                    <Row>
                      <Col span={12}>
                        <FormItem label={'选择优惠券'}
                          {...formItemLayout02}>
                          {getFieldDecorator(`discountCoupon${index}`, {
                            // initialValue: '选择优惠券',
                            rules: [
                              { message: '请先选择优惠券' },
                            ],
                            initialValue: item.couponsConfigId ? item.couponsConfigId : item.couponsConfigId,
                          })(
                            <Select
                              // showSearch
                              // onSearch={(e) => handleSearch(e, 'Coupon')}
                              // defaultActiveFirstOption={false}
                              // filterOption={false}
                              placeholder={'选择优惠券'}
                              disabled={actionType == 'detail'}
                              onChange={(e, Option) => inputChange(e, 'discountCoupon', index, Option)}>
                              {
                                CouponList.map((list, index) => {
                                  return (
                                    <Select.Option value={list.couponsConfigId}>{list.name}</Select.Option>
                                  )
                                })
                              }

                            </Select>
                          )}
                        </FormItem>
                      </Col>
                      {
                        index > 0 ?
                          <Col className="col" span={1}>
                            <FormItem>
                              <Icon onClick={() => deleteProject('discountCoupon', index)} className="minusCircle" type="minus-circle" />
                            </FormItem>
                          </Col>
                          : null
                      }
                    </Row>
                  )
                })}
              </div> : null
            }
            {typeChange && typeChange === 5 ?
              <div>
                {
                  liveStreamingList.map((item, index) => {
                    return (
                      <Row>
                        <Col span={12}>
                          <FormItem label={'选择直播'}
                            {...formItemLayout02}>
                            {getFieldDecorator(`liveStreaming${index}`, {
                              // initialValue: '选择优惠券',
                              rules: [
                                { required: true, whitespace: true, message: '请选择直播活动' },
                              ],
                              initialValue: item.id ? item.id : '',
                            })(
                              <Select
                                showSearch
                                onSearch={(e) => handleSearch(e, 'live')}
                                defaultActiveFirstOption={false}
                                filterOption={false}
                                placeholder={'选择直播'}
                                disabled={actionType == 'detail'}
                                onChange={(e, opt) => inputChange(e, 'liveStreaming', index, opt)}>
                                {
                                  StreamingList.map((list, lds) => {
                                    return (
                                      <Select.Option value={list.id}>{list.title}</Select.Option>
                                    )
                                  })
                                }
                              </Select>
                            )}
                          </FormItem>
                        </Col>
                        {
                          index > 0 ?
                            <Col className="col" span={1}>
                              <FormItem>
                                <Icon onClick={() => deleteProject('liveStreaming', index)} className="minusCircle" type="minus-circle" />
                              </FormItem>
                            </Col>
                            : null
                        }
                      </Row>
                    )
                  })
                }
              </div> : null
            }
            {typeChange && typeChange === 3 ?
              <Row>
                <Col span={14}>
                  <FormItem
                    {...formItemLayout03}
                    extra={'建议视频画面比例为16:9，视频大小在100M以下。'}
                    // disabled={actionType == 'detail'}
                    required={true}
                    label="上传视频">
                    {getFieldDecorator('columnPosters', {
                      initialValue: activityDetail.shareImgUrl,
                      rules: [
                        { required: true, message: '请上传分享海报图' }
                      ],
                    })(
                      <div className={cx('uploaderBox')}>
                        <div className={cx('uploaderDiv')}>
                          <Uploader
                            uploadedUrls={recordVideoUrlArr}
                            removeFileCbf={(e) => { removeImgUrl('columnPosters', e) }}
                            uploadSuccessCbf={(imgUrl) => { updateImageModel(imgUrl, 'columnPosters') }}
                            showType={'5'}
                            accept={'.mp4'}
                            uploadTip="支持扩展名：.mp4"
                            fileType='video'
                            fileMaxSize='100'
                            maxFiles='1' />
                        </div>
                      </div>
                    )}

                  </FormItem>
                </Col>
              </Row> : null
            }
            {typeChange && typeChange === 4 ?
              <div>
                {
                  acttiveList.map((item, index) => {
                    return (
                      <Row>
                        <Col span={12}>
                          <FormItem label={'选择报名活动'}
                            {...formItemLayout02}>
                            {getFieldDecorator(`businessId${index}`, {
                              initialValue: item.contentId ? item.contentId : '',
                            })(
                              <Select
                                // showSearch
                                // onSearch={(e) => handleSearch(e, 'active')}
                                // defaultActiveFirstOption={false}
                                // filterOption={false}
                                placeholder={'选择报名活动'}
                                disabled={actionType == 'detail'}
                                onChange={(e, opt) => inputChange(e, 'businessId', index, opt)}>
                                {
                                  acttives.map((list, lds) => {
                                    return (
                                      <Select.Option value={list.contentId}>{list.title}</Select.Option>
                                    )
                                  })
                                }
                              </Select>
                            )}
                          </FormItem>
                        </Col>
                        {
                          index > 0 ?
                            <Col className="col" span={1}>
                              <div title="删除">
                                <FormItem>
                                  <Icon onClick={() => deleteProject('active', index)} className="minusCircle" type="minus-circle" />
                                </FormItem>
                              </div>
                            </Col>
                            : null
                        }
                      </Row>
                    )
                  })
                }
              </div> : null
            }
          </Col>
          {(typeChange != '' && typeChange != 3) ? <Col span={2} offset={2} className="addxiang">
            <FlagBtn node={<Button onClick={() => addColumn(typeChange)} type="primary">添加</Button>} btnId={''}> </FlagBtn>
          </Col> : null}
        </Row>
      </Modal>

      {/* 专区样式图片预览 */}
      <Modal className="zhanimg"
        maskClosable={true}
        onCancel={() => { hideImgModal() }}
        footer={null}
        visible={openImg}>
        <div className="stylesPic">
          <img src={openImgSrc} alt="" srcset="" />
        </div>

      </Modal>
    </div >



  )
}

// 连接视图(view)和模型(model)
export default connect(mapStateToProps)(Form.create()(routeView))
